package com.gitee.kenewstar.migration.core;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * @author kenewstar
 */
@Slf4j
@ResponseBody
@ControllerAdvice
public class DataMigrationExceptionHandler {


    @ExceptionHandler(Exception.class)
    @ResponseStatus(HttpStatus.OK)
    public ExceptionResponse exceptionHandler(Exception ex) {
        log.info("============== Error Exception ==============={}", ex.getMessage());
        ex.printStackTrace();
        return ExceptionResponse.result(ex);
    }

}
